﻿@model RegionJoinList
@{
    ViewBag.Title = "List Region";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section _Right {
    @Html.Partial("_Right")
}
<h2>
    List Region</h2>
<div class="grid-main">
    @(Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(keys => keys.Add(p => p.ID))
        .ToolBar(toolbar => toolbar.Template(@<text>@item.CustomCommandToolBarButton("insertnew", "Add new Region", "Add", "Region", null, false, GridButtonType.Text)</text>))
        .Columns(columns =>
        {
            columns.Bound(o => o.No).Width(50);
            columns.Bound(o => o.Name).Width(150);
            columns.Bound(o => o.ParentName).Width(150).Title("Region Higher Level");
            columns.Bound(o => o.CreateAt).Format("{0:dd/MM/yyyy}").Width(80);
            columns.Command(commands =>
                {
                    commands.Custom("viewDetail")
                        .Text("Edit")
                        .DataRouteValues(route => route.Add(o => o.ID).RouteKey("regionID"))
                        .Ajax(false)
                        .Action("Edit", "Region")
                        .HtmlAttributes(new { style = "text-align: center" });
                    commands.Delete();
                })
                .Width(160);

        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Server().Select("Index", "Region", new { ajax = true });
            dataBinding.Ajax().Select("AjaxIndex", "Region").Enabled(true)
                .Delete("AjaxDelete", "Region");
        })
        .Selectable()
        .Scrollable(scrolling => scrolling.Enabled(true))
        .Sortable(sorting => sorting.Enabled(true))
        .Pageable(paging => paging.PageSize(20).Enabled(true))
        .Filterable(filtering => filtering.Enabled(true))
        .Groupable(grouping => grouping.Enabled(true))
        .Footer(true)
        .ClientEvents(events => events.OnComplete("Assessments_onComplete"))
)
</div>
<script src="@Url.Content("~/Scripts/indo.common.js")" type="text/javascript"></script>